package at.tugraz.hidipic.model;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.security.core.GrantedAuthority;

/**
 *
 * @author mario
 */
@Entity
@Table(name="customgrantedauthority")
public class CustomGrantedAuthority implements GrantedAuthority {

    @Id
    private String authority;

    @Override
    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof CustomGrantedAuthority) {
            return this.authority.equals(((CustomGrantedAuthority)obj).getAuthority());
        } else {
            return false;
        }
    }
    @Override
    public int hashCode() {
        return this.authority.hashCode();
    }
}
